package 多态;

/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2022-05-15
 * Time:21:45
 */

class Animial{
    private  String name;
    private  int age;

    public Animial(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void eat(){
        System.out.println(name+"正在吃饭！");
    }

    @Override
    public String toString() {
        return "Animial{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

class Dog extends Animial{

    public Dog(String name, int age) {
        super(name, age);
    }

    public void bark(){
        System.out.println(getName()+"汪汪汪！");
    }
}

class Bird extends Animial{

    public Bird(String name, int age) {
        super(name, age);
    }

    public void fly(){
        System.out.println(getName()+"正在飞！");
    }
}
public class Test {
    public static void main(String[] args) {

    }
}
